#include <iostream>
#include <vector>
#include <queue>
#include <algorithm>
#include <map>
#include <set>
#include <cstring>
#define endl "\n"
using namespace std;
int n, m, t;
struct pig { int tim, mon; } a[205];
int f[205][205][205];
int dfs(int step, int nm, int nt) {
	if (nm < 0 || nt < 0)return -1;
	if (f[step][nm][nt] != -1)return f[step][nm][nt];
	if (step >= n)return 0;
	return f[step][nm][nt] = max(dfs(step + 1, nm - a[step + 1].mon, nt - a[step + 1].tim) + 1, nm, nt));
int main() {
	scanf("%d%d%d", &n, &m, &t);
	memset(f, -1, sizeof(f));
	for (int i = 1; i <= n; i++)scanf("%d%d", &a[i].tim, &a[i].mon);
	printf("%d\n", dfs(0, m, t));
	return 0;
}